<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:t="http://myfaces.apache.org/tomahawk"
	template="/pages/template/main-layout.xhtml">

	<ui:define name="content">
		<t:saveState value="#{therapyRoleBean.role}" />

		<h:panelGrid cellpadding="5" width="100%" columns="2" columnClasses="width30,width70">

			<p:dataTable id="rolelist" var="ci" value="#{therapyRoleBean.roleModel}" rowKey="#{ci.id}"
				selection="#{therapyRoleBean.role}" selectionMode="single">
				<p:ajax event="rowSelect" listener="#{therapyRoleBean.selectRole}"
					update=":mainform:therapyTree" />
				<p:column headerText="ROLE NAME">
					<h:outputText value="#{ci.name}" />
				</p:column>
			</p:dataTable>

			<h:panelGrid width="100%">
				<p:commandButton value="#{msgs.button_submit}" actionListener="#{therapyRoleBean.submit}"
					style="float:left;" update=":messages" />
					
				<p:tree value="#{therapyRoleBean.rootNode}" var="node" id="therapyTree" selectionMode="checkbox"
					selection="#{therapyRoleBean.selectedNodes}"  style="width:40%">

					<p:treeNode>
						<h:outputText styleClass="ui-icon ui-icon-cancel" rendered="#{node.status eq 0}" />
						<h:outputText value="#{node.name}" />
						<h:outputText value="&#160;" />
						<h:outputText value="#{node.sort}" />
					</p:treeNode>
				</p:tree>
			</h:panelGrid>
		</h:panelGrid>
	</ui:define>
</ui:composition>
